import { get, post } from '@/utils/request'
export default {

  namespaced: true,
  state: {
    // 产品数据对象
    productData: {},
    // 产品分类对象
    proCategory: {},
    deleteById:{}
  },

  mutations: {

    SET_PRODUCTDATA(state, data) {

      state.productData = data
    },
    SET_PROCATEGORY(state, data) {
      state.proCategory = data
    },
    SET_PRODELETEBYID(state,data){
      state.deleteById = data
    }

    
  },

  actions: {

    async getProductDataVuex({ commit }, param) {

      let res = await get('/product/pageQuery', param)
      // console.log(res.data)
      commit('SET_PRODUCTDATA', res.data)
    },

    async getProCategoryDataVuex({ commit }, param) {
      let res = await get('/productCategory/pageQuery', param)

      commit('SET_PROCATEGORY', res.data)
    }, 
    async getDeleteByIdDataVuex({ commit }, param) {
      let res = await get('productCategory/deleteById', param)
      // console.log(res.data)
      commit('SET_PRODELETEBYID', res.data)
    }

  }
}